<!--该组件缺乏复用性 别用-->
<template>
	<view>
		<u-popup :show="popShow" mode="bottom" :round="10"   @close="closePop" >
			<view class="pop-box">
				<view class="pop-text">是否同意接受以下消息推送</view>
				<view class="cell-box">
					<view class="cell-item">
						<view class="cell-left">
							<u-icon name="checkmark-circle-fill" color="#03c160"  size="22"></u-icon>
							<view class="cell-text">园区公告</view>
							</view>
						<view class="cell-icon"><u-icon name="info-circle" color="#03c160"  size="22"></u-icon></view>
					</view>
					<view class="cell-item">
						<view class="cell-left">
							<u-icon name="checkmark-circle-fill" color="#03c160"  size="22"></u-icon>
							<view class="cell-text">园区通知</view>
							</view>
						<view class="cell-icon"><u-icon name="info-circle" color="#03c160"  size="22"></u-icon></view>
					</view>
					<view class="cell-item">
						<view class="cell-left">
							<u-icon name="checkmark-circle-fill" color="#03c160"  size="22"></u-icon>
							<view class="cell-text">报修结果反馈</view>
							</view>
						<view class="cell-icon"><u-icon name="info-circle" color="#03c160"  size="22"></u-icon></view>
					</view>
				</view>
				<view class="btn-box">
					<u-button text="取消" :customStyle="{marginRight: '20px', borderRadius:'10rpx'}" @click="closePop"></u-button>
					<u-button type="success" text="同意" :customStyle="{borderRadius:'10rpx'}" @click="toAuth"></u-button>
				</view>
			</view>
		</u-popup>
	</view>
</template>

<script>
import cache from '@/config/cache'
	export default {
		name:"sk-push-pop",
		props: {
			close: {
				type: Function,
				// default: () => []
				// default: () => () => {}
				default: undefined,
			  required: false
			},

			back: { // 跳转页面 0首页 1我的
			    type: Number,
			    default: undefined,
			    required: false
			},
			backUrl: { // 跳转页面Url
			    type: String,
			    default: undefined,
			    required: false
			},
		},

		data() {
			return {
				popShow:false,
			};
		},
		created() {
			if (this.close) {
				this.closePop = this.close
			}
		},
		methods:{
			open(){
				this.popShow =true
			},
			closePop() {
				this.popShow = false

				uni.switchTab({
					url: "/pages/index/index"
				})
			},
			toAuth(){
				const userinfo = cache.get("userinfo")
				userinfo.wechat_public_open_id = '用户点击了同意'
				cache.set("userinfo", userinfo);
				this.popShow = false
				// console.log(this.back)
				// 如果不存在返回页面标志 给一个默认值
				if(!this.back){
					this.$emit('update:back',0)
				}
				uni.navigateTo({
					url:"/packageMe/pages/wecaht/wecaht"
				})
			}
		}
	}
</script>

<style lang="scss">
.pop-box{
	padding: 30rpx;
	width: calc(100vw - 60rpx);
	.pop-text{
		font-size: 36rpx;
	}
	.cell-box{
		margin-top: 40rpx;
		margin-bottom: 40rpx;
		.cell-item{
			display: flex;
			flex-direction: row;
			justify-content: space-between;
			height: 40px;
			padding: 0 20rpx;
			line-height: 40px;
			font-size: 34rpx;
			letter-spacing: 3px;
			border-bottom: 1px solid #ccc;
			&:first-child{
				border-top: 1px solid #ccc;
			}
			.cell-left{
				display: flex;
				flex-direction: row;
				.cell-text{
					padding-left: 10rpx;
				}
			}
			.cell-icon{
				display: flex;
				justify-content: center;
			}
		}
	}
	.btn-box{
		display: flex;
		flex-direction: row;
		margin: 40rpx;
	}
}

</style>
